<% title (t "general.sitename") + " - " + (t "resetpass.general.title") %>
<%= queue_js "jquery.validate.js" %>
<%= render "frontend/portal/partials/topnotify" %>
<% if @show_form %>
<form id="reset-pass-form" method="post" action="<%= request.fullpath %>">
  <legend><%= t"resetpass.general.title" %></legend>
  <div class="control-group">
    <label><%= t"register.form.password" %></label>
    <input type="password" placeholder="<%= t"resetpass.form.passwordhelper" %>" name="password" id="input-password"/>
  </div>
  <div class="control-group">
    <label><%= t"register.form.repeatpassword" %></label>
    <input type="password" placeholder="<%= t"resetpass.form.repasswordhelper" %>" name="password_confirm" id="input-password-confirm"/>
  </div>
  <button type="submit" class="btn btn-primary"><%= t"forgotpass.form.button" %></button>
</form>
<script type="text/javascript">
  $(document).ready(function(){
      $("#reset-pass-form").validate({
          rules:{
              password:{
                  required:true,
                  minlength: 6
              },
              password_confirm:{
                  required:true,
                  equalTo: "#input-assword"
              }
          },
          messages:{
              password:{
                  required:"Bạn chưa nhập mật khẩu",
                  minlength:"Mật khẩu phải nhiều hơn 6 kí tự"
              },
              password_confirm:{
                  required:"Hãy xác nhận mật khẩu",
                  equalTo:"Xác nhận mật khẩu không khớp"
              }
          },
          errorClass: "help-inline",
          errorElement: "span",
          highlight:function(element, errorClass, validClass) {
              $(element).parents('.control-group').addClass('error');
          },
          unhighlight: function(element, errorClass, validClass) {
              $(element).parents('.control-group').removeClass('error');
              $(element).parents('.control-group').addClass('success');
          }
      });
  });
</script>
<% end %>